#ifndef log4c_log4c_h
#define log4c_log4c_h

#if defined(WITH_LOG4C) 

#include <log4c/version.h>
#include <log4c/init.h>
#include <log4c/rc.h>
#include <log4c/appender.h>
#include <log4c/rollingpolicy.h>
#include <log4c/category.h>
#include <log4c/layout.h>
#include <log4c/logging_event.h>
#include <log4c/priority.h>

LOG4C_DATA log4c_category_t* g_logger;

#define LOG_Init(xml) \
	log4c_init(xml)

#define LOG_Logger(name)	\
	g_logger = log4c_category_get(name)

#define LOG_DEBUG(fmt, ...)	\
	log4c_category_debug(g_logger, fmt , ##__VA_ARGS__)

#define LOG_ERROR(fmt, ...)	\
	log4c_category_error(g_logger, fmt, ##__VA_ARGS__)

#define LOG_INFO(fmt, ...)	\
	log4c_category_info(g_logger, fmt , ##__VA_ARGS__)

#define LOG_WARN(fmt, ...)		\
	log4c_category_warn(g_logger, fmt , ##__VA_ARGS__)

#define LOG_NOTICE(fmt, ...)	\
	log4c_category_notice(g_logger, fmt , ##__VA_ARGS__)

#define LOG_TRACE(fmt, ...)	\
	log4c_category_trace(g_logger, fmt, ##__VA_ARGS__)


#define LOG_DEBUG_V(logger, fmt, ...)	\
	log4c_category_debug(logger, fmt , ##__VA_ARGS__)

#define LOG_ERROR_V(logger, fmt, ...)	\
	log4c_category_error(logger, fmt, ##__VA_ARGS__)

#define LOG_INFO_V(logger, fmt, ...)	\
	log4c_category_info(logger, fmt , ##__VA_ARGS__)

#define LOG_WARN_V(logger, fmt, ...)		\
	log4c_category_warn(logger, fmt , ##__VA_ARGS__)

#define LOG_NOTICE_V(logger, fmt, ...)	\
	log4c_category_notice(logger, fmt , ##__VA_ARGS__)

#define LOG_TRACE_V(logger, fmt, ...)	\
	log4c_category_trace(logger, fmt, ##__VA_ARGS__)

#else

#define LOG_Init(xml)

#define LOG_Logger(name)	

#define LOG_DEBUG(fmt, ...)

#define LOG_ERROR(fmt, ...)

#define LOG_INFO(fmt, ...) 

#define LOG_WARN(fmt, ...)	

#define LOG_NOTICE(fmt, ...) 

#define LOG_TRACE(fmt, ...)	

#define LOG_DEBUG_V(logger, fmt, ...)

#define LOG_ERROR_V(logger, fmt, ...)

#define LOG_INFO_V(logger, fmt, ...)	

#define LOG_WARN_V(logger, fmt, ...)

#define LOG_NOTICE_V(logger, fmt, ...)	

#define LOG_TRACE_V(logger, fmt, ...)  

#endif

#endif

